/** 
 * Project Name:eleme-website 
 * File Name:MenuCategoryDao.java 
 * Package Name:com.eleme.dao.impl 
 * Date:2017年12月26日下午4:52:16 
 * Copyright (c) 2017, fakedesigner@163.com All Rights Reserved. 
 * 
*/  
  
package com.eleme.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import com.eleme.dao.IMenuCategoryDao;
import com.eleme.entity.MenuCategory;


/** 
 * ClassName:MenuCategoryDao <br/> 
 * Function: TODO ADD FUNCTION. <br/> 
 * Reason:   TODO ADD REASON. <br/> 
 * Date:     2017年12月26日 下午4:52:16 <br/> 
 * @author   Pan 
 * @version   
 * @since    JDK 1.8 
 * @see       
 */
public class MenuCategoryDao extends BaseDao<MenuCategory> implements IMenuCategoryDao{

	
	public MenuCategory createEntity() {
		return new MenuCategory();
	}	
	
	
	
	public List<MenuCategory> getMenuCategory(int shopid) {
		List<MenuCategory> li = null;
		ResultSet res;
		String sql = "select * from MenuCategory Where shopid = " + shopid + " order by serialno";
		try {
			LOGGER.debug("getMenuCategory：" + sql);
			res = getConnection().prepareStatement(sql).executeQuery();
			if (res != null) 
			  li = createEntities(res);
		} catch (SQLException e) {
			LOGGER.error("getMenuCategory失败：" + sql + "，错误信息：" + e.getMessage());
			e.printStackTrace();
		}
		return li;
	}



	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MenuCategoryDao s = new MenuCategoryDao();
		List<MenuCategory> li = s.getMenuCategory(1);
		System.out.println(li.get(0).getNote());

	}

}
